/*
#include <iostream>
#include "Tuple.hpp"
using namespace std;
using namespace math;

void main()
{
	const double tuple1[] = {1, 2, -3, 4};
	double tuple2[] = {3, -4, 1, 3};
	Tuple A( 4, tuple1 );
	Tuple B( 4, tuple2 );

	cout << A - B << endl;
	cout << A << endl;
	cout << B << endl;
}
*/
#include <iostream>
#include "Tuple.hpp"
using namespace std;
using math::Tuple;

int main()
{
	Tuple defaultTuple; 
	cout << defaultTuple << endl;

	Tuple setSize(5);
	cout << setSize << endl;

	double arrayTup[7];
	arrayTup[0] = 1;
	arrayTup[1] = 2;
	arrayTup[2] = 3;
	arrayTup[3] = 4;
	arrayTup[4] = 5;
	arrayTup[5] = 6;
	arrayTup[6] = 10;
	Tuple arraySet(7, arrayTup);
	cout << arraySet << endl;

	const Tuple TupleCopy(arraySet);
	cout << "TupleCopy: " << TupleCopy << endl;

	Tuple equalTuple;
	cout << equalTuple << endl;
	equalTuple = arraySet;
	cout << equalTuple << endl;

	double arrayTup2[7];
	arrayTup2[0] = 1;
	arrayTup2[1] = 6;
	arrayTup2[2] = -3;
	arrayTup2[3] = 4;
	arrayTup2[4] = 20;
	arrayTup2[5] = -67;
	arrayTup2[6] = 10;
	Tuple arraySet2(7, arrayTup2);
	cout << arraySet2 << endl;
	cout << arraySet2.dot(arraySet) << endl;
	cout << arraySet2.length() << endl;

	//== check
	if(arraySet == arraySet2)
		cout << "equal" << endl;
	else
		cout << "not equal" << endl;
	if(arraySet == TupleCopy)
		cout << "equal" << endl;
	else
		cout << "not equal" << endl;

	if(arraySet != arraySet2)
		cout << "not equal" << endl;
	else
		cout << "equal" << endl;
	if(arraySet != TupleCopy)
		cout << "not equal" << endl;
	else
		cout << "equal" << endl;

	cout << arraySet + arraySet2 << endl;
	arraySet += arraySet2;
	cout << arraySet << endl;
	cout << arraySet - arraySet << endl;
	arraySet -= arraySet2;
	cout << arraySet << endl;
	cout << arraySet * 3.0 << endl;
	cout << 4.5*arraySet << endl;
	arraySet *= 3;
	cout << arraySet << endl;
	cout << arraySet / 3 << endl;
	arraySet /= 3;
	cout << arraySet << endl;
	cout << "neg: " << -arraySet2 << endl;
	cout << "pos: " << arraySet2 << endl;
	cout << "minus neg: " << arraySet2 - -arraySet2 << endl;

	arraySet[5] = 141414;
	cout << arraySet << endl;
	cout << arraySet[5] << endl;

	try
	{
		arraySet[7] = 5;
		//setSize + arraySet;
		//setSize += arraySet;
		//setSize = setSize - arraySet;
		//setSize -= arraySet;
		//setSize.dot(arraySet);
		setSize /= 0;
		cout << "div zero: " << setSize << endl;
		cout << TupleCopy[2] << endl; //fine statement
		//cout << TupleCopy[7];
		//TupleCopy[2] = 5;
		//const Tuple ConstTuple = TupleCopy;
		//const Tuple ConstTuple(TupleCopy);
		const Tuple ConstTuple(arraySet2);
		cout << 5*ConstTuple << endl;
		cout << ConstTuple << endl;
		//cout << TupleCopy << endl;
		cout << "before zero\n";
		Tuple zero(0);
		Tuple neg(2);
		//cout << "neg tuple " << neg[-1] << endl;
		//cout << "ZERO HERE" << zero[0] << endl;
		cout << "No errors occurred.\n";
	}
	catch(math::Tuple::OutOfBounds error)
	{
		cout << error.what() << endl;
	}
	catch(math::Tuple::SizeMismatch error)
	{
		cout << error.what() << endl;
	}

	Tuple t1(0), t2(5);
	t1 = t2;
	cout << t1 << t2 << endl;
	Tuple t3(0);
	t1 = t3;
	cout << t1 << t3 << endl;
	if(t1 == t3)
		cout << "match\n";

	cout << endl;

	return 0;
}